﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Main.Master" AutoEventWireup="true"
    CodeBehind="CreateAcknowledgment.aspx.cs" Inherits="VSM.CreateAcknowledgment" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <script type="text/javascript">
        function isNumberKey(sender, evt) {
            var txt = sender.value;
            var dotcontainer = txt.split('.');
            var charCode = (evt.which) ? evt.which : event.keyCode;
            if (!(dotcontainer.length == 1 && charCode == 46) && charCode > 31 && (charCode < 48 || charCode > 57))
                return false;

            return true;
        }
        function OpenItemPopup() {
            var Dealer = $("#<%= txtDealerCode.ClientID %>").val();

            var url = "../../ItemPopup.aspx?dealer=" + Dealer;
            Main.openCustomDialog(url, 600, 610);
        }
        function OpenVendor() {
            
            var url = "../../VendorPopup.aspx";
            Main.openCustomDialog(url, 600, 610);
        }
    </script>
    <div>
        <asp:UpdatePanel ID="updatePanel" runat="server" UpdateMode="Conditional">
            <ContentTemplate>
                <asp:HiddenField ID="hdnIsUpdate" runat="server" />
                <asp:HiddenField ID="hdnStatus" runat="server" />
                <h2>
                    &nbsp;<asp:Label ID="lblTitle" runat="server" Text="Acknowledgment"></asp:Label>
                </h2>
                <div style="margin-left: 5px; width: 99%;">
                    <hr />
                    <table border="0" width="100%" style="background-color: #D1D4D8; font-weight: bold;">
                        <tr>
                            <td>Ack. No.:</td>
                            <td>
                                <asp:Label ID="lblAckNo" runat="server"></asp:Label>
                            </td>
                            <td width="100px">&nbsp;</td>
                            <td align="left">
                                &nbsp;</td>
                        </tr>
                        <tr>
                            <td>Dealer:</td>
                            <td colspan="3">
                                <asp:TextBox ID="txtDealerCode" runat="server" BackColor="#E6E6E6" 
                                    ReadOnly="True" Width="122px"></asp:TextBox>
                                <asp:TextBox ID="txtDealerName" runat="server" Width="250px"></asp:TextBox>
                                <asp:Button ID="btnSelectDealer" runat="server" 
                                    OnClientClick="OpenVendor(); return false;" 
                                    Style="background-image: url('/Images/bgButton.png'); background-repeat: no-repeat; font-weight: bold" 
                                    Text="..." />
                            </td>
                        </tr>
                        <tr>
                            <td style="width: 150px">Issue Date:</td>
                            <td style="width: 250px">
                                <asp:TextBox ID="txtIssueDate" runat="server" AutoPostBack="True" ></asp:TextBox>
                                <asp:ImageButton ID="Image1" runat="Server" AlternateText="Click to show calendar" ImageUrl="~/Images/Calendar_scheduleHS.png" />
                                <cc1:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="txtIssueDate" PopupButtonID="Image1" Format="dd/MM/yyyy"></cc1:CalendarExtender>
                            </td>
                        </tr>
                    </table>
                    <table id="Table1" width="100%" style="font-weight: bold">
                        <caption align="left" style="font-size: 14px" 
                            title="Purchase Order Information:">
                            <tr>
                                <td style="white-space: nowrap; width: 15%" valign="middle">PO No:</td>
                                <td style="width: 35%">
                                    <asp:TextBox ID="txtPONo0" runat="server" BackColor="#E6E6E6" ReadOnly="True" Width="100px"></asp:TextBox>
                                    <asp:Button ID="btnSelectPONo0" runat="server" 
                                        OnClientClick="OpenVendor(); return false;" 
                                        Style="background-image: url('/Images/bgButton.png'); background-repeat: no-repeat; font-weight: bold" 
                                        Text="..." />
                                </td>
                                <td style="width: 15%">PO Type:</td>
                                <td style="width: 35%">
                                    <asp:DropDownList ID="ddlPOType" runat="server">
                                        <asp:ListItem Value="0">PO</asp:ListItem>
                                        <asp:ListItem Value="1">ePO</asp:ListItem>
                                    </asp:DropDownList>
                                </td>
                            </tr>
                            <tr>
                                <td style="width: 15%" valign="middle">PO Issue Date:</td>
                                <td width="35%">
                                    <asp:TextBox ID="txtPOIssueDate" runat="server" AutoPostBack="True"></asp:TextBox>
                                    <cc1:CalendarExtender ID="txtPOIssueDate_CalendarExtender" runat="server" 
                                        Format="dd/MM/yyyy" PopupButtonID="Image2" 
                                        TargetControlID="txtPOIssueDate">
                                    </cc1:CalendarExtender>
                                    <asp:ImageButton ID="Image2" runat="Server" 
                                        AlternateText="Click to show calendar" 
                                        ImageUrl="~/Images/Calendar_scheduleHS.png" />
                                </td>
                                <td width="15%">Posting Date:</td>
                                <td width="35%">
                                    <asp:TextBox ID="txtPostingDate" runat="server" AutoPostBack="True"></asp:TextBox>
                                    <cc1:CalendarExtender ID="txtPostingDate_CalendarExtender" runat="server" 
                                        Format="dd/MM/yyyy" PopupButtonID="Image3" 
                                        TargetControlID="txtPostingDate">
                                    </cc1:CalendarExtender>
                                    <asp:ImageButton ID="Image3" runat="Server" 
                                        AlternateText="Click to show calendar" 
                                        ImageUrl="~/Images/Calendar_scheduleHS.png" />
                                </td>
                            </tr>
                        </caption>
                    </table>
                    <hr />
                    <div style="width: 100%">
                        <asp:GridView ID="grvPO" CssClass="GridInner" runat="server" Width="100%" BorderColor="White"
                            BackColor="White" AllowSorting="True" AutoGenerateColumns="False" CellPadding="2"
                            HeaderStyle-Height="27px" OnRowCreated="grvPO_RowCreated" CellSpacing="2" OnRowEditing="EditItem"
                            OnRowUpdating="UpdateItem" HeaderStyle-VerticalAlign="Middle" OnRowCancelingEdit="CancelEdit"
                            AllowPaging="True" OnPageIndexChanging="grvSearchResult_PageIndexChanging" PageSize="20"
                            OnRowDeleting="DeleteItem" OnRowDataBound="grvSearchResult_RowDataBound">
                            <PagerSettings Mode="NumericFirstLast" />
                            <PagerStyle BackColor="#70A0D0" Font-Bold="True" HorizontalAlign="Center" VerticalAlign="Middle" />
                            <RowStyle BackColor="#D9E0ED" BorderColor="White" BorderWidth="2px" Height="25px" />
                            <AlternatingRowStyle BackColor="#EEF1F7" BorderColor="White" BorderWidth="2px" />
                            <Columns>
                                <asp:CommandField HeaderText="Action" ShowDeleteButton="True" ShowEditButton="False"
                                    Visible="false" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center"
                                    ItemStyle-Width="70px" />
                                <asp:TemplateField HeaderText="Action">
                                    <ItemStyle HorizontalAlign="Center" Width="20px" />
                                    <HeaderStyle VerticalAlign="Middle" />
                                    <ItemTemplate>
                                        <asp:LinkButton ID="lnkDelete" runat="server" Text="Delete" TabIndex="-1" OnClick="lnkDelete_Click"></asp:LinkButton>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="#">
                                    <ItemStyle HorizontalAlign="Center" Width="20px" />
                                    <HeaderStyle VerticalAlign="Middle" />
                                    <ItemTemplate>
                                        <asp:Label ID="lblNo" runat="server" Text="" BorderStyle="none">
                                        </asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Item Code">
                                    <ItemStyle HorizontalAlign="Center" Width="100px" />
                                    <HeaderStyle VerticalAlign="Middle" Font-Bold="true" />
                                    <ItemTemplate>
                                        <asp:Label ID="lblItemCode" runat="server" Text='<%# Bind("ItemCode") %>' BorderStyle="none"></asp:Label>
                                        <asp:HiddenField ID="hdnVatGroup" runat="server" Value='<%# Bind("VatgroupPu") %>'></asp:HiddenField>
                                        <asp:HiddenField ID="hdnRate" runat="server" Value='<%# Bind("Rate") %>'></asp:HiddenField>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Item Name">
                                    <ItemStyle HorizontalAlign="left" Width="500px" />
                                    <HeaderStyle VerticalAlign="Middle" Font-Bold="true" />
                                    <ItemTemplate>
                                        <asp:Label ID="txtItemName" runat="server" Text='<%# Bind("Dscription") %>' BorderStyle="none" />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Model">
                                    <ItemStyle HorizontalAlign="left" Width="80px" />
                                    <HeaderStyle VerticalAlign="Middle" Font-Bold="true" />
                                    <ItemTemplate>
                                        <asp:Label ID="txtModel" runat="server" Text='<%# Bind("Model") %>' BorderStyle="none" />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                 <asp:TemplateField HeaderText="Unit Price">
                                    <ItemStyle HorizontalAlign="Right" />
                                    <HeaderStyle VerticalAlign="Middle" Width="120px" />
                                    <ItemTemplate>
                                        <asp:Label ID="txtUnitPrice" runat="server" Text='<%#String.Format("{0,-15:#,##0.00}", Eval("Price"))%>' BorderStyle="none" />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="UoM">
                                    <HeaderStyle VerticalAlign="Middle" />
                                    <ItemStyle HorizontalAlign="Center" />
                                    <ItemTemplate>
                                        <asp:Label ID="txtUoM" runat="server" Text='<%# Bind("BuyUnitMsr") %>' BorderStyle="none" />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Order Quantity">
                                    <ItemStyle HorizontalAlign="Right" />
                                    <HeaderStyle VerticalAlign="Middle" Width="100px" />
                                    <ItemTemplate>
                                        <asp:TextBox ID="txtOrderQuantity" runat="server" Width="97%" Text='<%# Eval("Quantity")%>'
                                            AutoPostBack="true" OnKeyPress="return isNumberKey(this, event);" Style="text-align: right" OnTextChanged="txtOrderQuantity_OnTextChanged"/>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Received Quantity" Visible="false">
                                    <ItemStyle HorizontalAlign="Right" />
                                    <HeaderStyle VerticalAlign="Middle" Width="80px" />
                                    <ItemTemplate>
                                        <asp:Label ID="txtReceivedQuantity" runat="server" Text='<%# Bind("ReceivedQty") %>' BorderStyle="none" />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Balance Quantity" Visible="false">
                                    <ItemStyle HorizontalAlign="Right" />
                                    <HeaderStyle VerticalAlign="Middle" Width="80px" />
                                    <ItemTemplate>
                                        <asp:Label ID="txtBalanceQty" runat="server" Text='<%#String.Format("{0,-15:#,##0.00}", Eval("BalanceQty"))%>' BorderStyle="none" />
                                    </ItemTemplate>
                                </asp:TemplateField>

                                <asp:TemplateField HeaderText="Remain">
                                    <ItemStyle HorizontalAlign="Right" />
                                    <HeaderStyle VerticalAlign="Middle" Width="120px" />
                                    <ItemTemplate>
                                        <asp:Label ID="txtRemain" runat="server" Text='<%#String.Format("{0,-15:#,##0.00}", Eval("Remain"))%>' BorderStyle="none" />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Checking">
                                    <ItemStyle HorizontalAlign="Right" />
                                    <HeaderStyle VerticalAlign="Middle" Width="100px" />
                                    <ItemTemplate>
                                        <asp:TextBox ID="txtChecking" runat="server" Width="97%" Text='<%# Eval("Checking")%>'
                                            AutoPostBack="true" OnKeyPress="return isNumberKey(this, event);" Style="text-align: right" />
                                    </ItemTemplate>
                                </asp:TemplateField>
                            </Columns>
                            <HeaderStyle BackColor="#6095C9" Font-Bold="true" ForeColor="#ffffff" Font-Overline="False"
                                Height="27px" VerticalAlign="Bottom" />
                            <EmptyDataTemplate>
                                <table class="GridInner" style="width: 100%; border-color: White;" border="1" rules="all" cellspacing="2" cellpadding="2">
                                    <tr valign="middle" style="height: 27px; color: white; font-weight: bold; text-decoration: none; background-color: rgb(96, 149, 201);">
                                        <th>
                                            <span>Action</span>
                                        </th>
                                        <th>
                                            <span>#</span>
                                        </th>
                                        <th>
                                            <span>Item Code</span>
                                        </th>
                                        <th>
                                            <span>Item Name</span>
                                        </th>
                                        <th>
                                            <span>Model</span>
                                        </th>
                                         <th>
                                            <span>Unit Price</span>
                                        </th>
                                        <th>
                                            <span>UoM</span>
                                        </th>
                                        <th>
                                            <span>Quantity</span>
                                        </th>
                                        <th>
                                            <span>Remain</span>
                                        </th>
                                        <th>
                                            <span>Checking</span>
                                        </th>
                                    </tr>
                                    <tr>
                                        <td colspan="12">
                                            <span>No Data</span>
                                        </td>
                                    </tr>
                                </table>
                            </EmptyDataTemplate>
                        </asp:GridView>
                    </div>
                    <hr width="100%" />
                </div>
                <table width="100%" border="0">
                    <tr>
                        <td valign="top" style="width: 300px;">
                            <table>
                                <tr>
                                    <td>
                                        <strong>Remarks :</strong>
                                    </td>
                                    <td>
                                        <asp:TextBox runat="server" ID="txtRemarks" Height="71px" TextMode="MultiLine" Width="222px"></asp:TextBox>
                                    </td>
                                </tr>
                            </table>
                        </td>
                        <td>
                            <div style="margin-left: 75%; margin-right: 5px;">
                                <table border="0">
                                    <tr valign="middle" style="height: 27px; color: black; font-weight: bold; text-decoration: none;
                                        background-color: #D9E0ED;">
                                        <td align="right">
                                            Sub Total:
                                        </td>
                                        <td style="width: 150px" align="right">
                                            <asp:Label ID="lblSubTotal" runat="server" Font-Bold="True" ForeColor="Red"></asp:Label>
                                        </td>
                                    </tr>
                                    <tr valign="middle" style="height: 27px; color: white; font-weight: bold; text-decoration: none;
                                        background-color: rgb(96, 149, 201);">
                                        <td align="right">
                                            Tax&nbsp; Amount:
                                        </td>
                                        <td style="width: 150px" align="right">
                                            <asp:Label ID="lblGSTAmount" runat="server" Font-Bold="True" ForeColor="Red"></asp:Label>
                                        </td>
                                    </tr>
                                    <tr valign="middle" style="height: 27px; font-weight: bold; text-decoration: none;
                                        background-color: #D9E0ED;">
                                        <td style="width: 150px" align="right">
                                            Grand Total:
                                        </td>
                                        <td align="right">
                                            <asp:Label ID="lblDocumentTotal" runat="server" Font-Bold="True" ForeColor="Red"></asp:Label>
                                        </td>
                                    </tr>
                                </table>
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2">
                            <div style="margin-left: 5px; width: 99%;">
                                <hr />
                            </div>
                            <table style="width: 100%">
                                <tr>
                                    <td style="width: 400px;">
                                        <asp:Button ID="btnSave" runat="server" Text="Save" Style="background-image: url('/Images/bgButton.png');
                                            background-repeat: no-repeat; color: White;" OnClick="btnSaveDraft_Click" 
                                            BorderStyle="Solid" />
                                        <asp:Button ID="btnCancel" runat="server" Text="Cancel" Style="background-image: url('/Images/bgButton.png');
                                            background-repeat: no-repeat; color: White;" BorderStyle="Solid" 
                                            OnClick="btnCancel_Click" />
                                    </td>
                                    <td>
                                        <asp:Label ID="lblError" runat="server" Visible="False" Font-Bold="True" ForeColor="Red"></asp:Label>
                                    </td>
                                </tr>
                                <tr>
                                    <td colspan="2">
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                </table>
            </ContentTemplate>
        </asp:UpdatePanel>
    </div>
</asp:Content>
